- if project
  - search_path_url = search_path(project_id: project.id)
- elsif group
  - search_path_url = search_path(group_id: group.id)
- else
  - search_path_url = search_path

%header.navbar.navbar-gitlab.qa-navbar.navbar-expand-sm
  %a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content
  .container-fluid
    .header-content
      .title-container
        %h1.title
          = link_to root_path, title: _('Dashboard'), id: 'logo' do
            = brand_header_logo
            - logo_text = brand_header_logo_type
            - if logo_text.present?
              %span.logo-text.d-none.d-sm-block
                = logo_text

        - if current_user
          = render "layouts/nav/dashboard"
        - else
          = render "layouts/nav/explore"

      .navbar-collapse.collapse
        %ul.nav.navbar-nav
          - if current_user
            = render 'layouts/header/new_dropdown'
          - if header_link?(:search)
            %li.nav-item.d-none.d-sm-none.d-md-block.m-auto
              = render 'layouts/search' unless current_controller?(:search)
            %li.nav-item.d-inline-block.d-sm-none.d-md-none
              = link_to search_path_url, title: _('Search'), aria: { label: _('Search') }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
                = sprite_icon('search', size: 16)
          - if header_link?(:issues)
            = nav_link(path: 'dashboard#issues', html_options: { class: "user-counter" }) do
              = link_to assigned_issues_dashboard_path, title: _('Issues'), class: 'dashboard-shortcuts-issues', aria: { label: _('Issues') }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
                = sprite_icon('issues', size: 16)
                - issues_count = assigned_issuables_count(:issues)
                %span.badge.badge-pill.issues-count{ class: ('hidden' if issues_count.zero?) }
                  = number_with_delimiter(issues_count)
          - if header_link?(:merge_requests)
            = nav_link(path: 'dashboard#merge_requests', html_options: { class: "user-counter" }) do
              = link_to assigned_mrs_dashboard_path, title: _('Merge requests'), class: 'dashboard-shortcuts-merge_requests', aria: { label: _('Merge requests') }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
                = sprite_icon('git-merge', size: 16)
                - merge_requests_count = assigned_issuables_count(:merge_requests)
                %span.badge.badge-pill.merge-requests-count{ class: ('hidden' if merge_requests_count.zero?) }
                  = number_with_delimiter(merge_requests_count)
          - if header_link?(:todos)
            = nav_link(controller: 'dashboard/todos', html_options: { class: "user-counter" }) do
              = link_to dashboard_todos_path, title: _('Todos'), aria: { label: _('Todos') }, class: 'shortcuts-todos', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
                = sprite_icon('todo-done', size: 16)
                %span.badge.badge-pill.todos-count{ class: ('hidden' if todos_pending_count.zero?) }
                  = todos_count_format(todos_pending_count)
          - if header_link?(:user_dropdown)
            %li.nav-item.header-user.dropdown
              = link_to current_user, class: user_dropdown_class, data: { toggle: "dropdown" } do
                = image_tag avatar_icon_for_user(current_user, 23), width: 23, height: 23, class: "header-user-avatar qa-user-avatar"
                = sprite_icon('angle-down', css_class: 'caret-down')
              .dropdown-menu.dropdown-menu-right
                = render 'layouts/header/current_user_dropdown'
          - if header_link?(:admin_impersonation)
            %li.nav-item.impersonation
              = link_to admin_impersonation_path, class: 'nav-link impersonation-btn', method: :delete, title: _('Stop impersonation'), aria: { label: _('Stop impersonation') }, data: { toggle: 'tooltip', placement: 'bottom', container: 'body' } do
                = icon('user-secret')
          - if header_link?(:sign_in)
            %li.nav-item
              %div
                - sign_in_text = allow_signup? ? _('Sign in / Register') : _('Sign in')
                = link_to sign_in_text, new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in'

      %button.navbar-toggler.d-block.d-sm-none{ type: 'button' }
        %span.sr-only= _('Toggle navigation')
        = sprite_icon('ellipsis_h', size: 12, css_class: 'more-icon js-navbar-toggle-right')
        = sprite_icon('close', size: 12, css_class: 'close-icon js-navbar-toggle-left')
